<template>
  <div class="header">
    <van-nav-bar v-if="router.currentRoute.value.path!== '/order' && router.currentRoute.value.path !== '/person' " 
    :title="router.currentRoute.value.name" left-arrow @click-left="router.back()" />
    <van-notice-bar   left-icon="volume-o" :text="text" v-if="text.length > 0" />
  </div>
</template>

<script setup lang="ts">
import { router } from "@/router/router";
import { headerDel, headerFun } from "@/tool/glo";
import { onMounted, ref } from "vue";

const text = ref("");

onMounted( () => {
 setTimeout(async() => {
  for (let i = 0; i < headerFun.value.text.length; i++) {
    text.value = headerFun.value.text[i];
    await new Promise((resolve) => setTimeout(resolve, 1000*10));
    headerDel(i);
  }
 }, 1000);
});
</script>

<style lang="scss" scope>
.header {
  width: 100%;

}
</style>
